clear
rng default
load IdSetM_final_x1
IdSetM{1}=IdSetM_final_x1;
load IdSetM_final_x2
IdSetM{2}=IdSetM_final_x2;
load IdSetM_final_x3
IdSetM{3}=IdSetM_final_x3; 
load IdSetM_final_x4
IdSetM{4}=IdSetM_final_x4;
load IdSetM_final_x5
IdSetM{5}=IdSetM_final_x5;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%% Projections in one dimension %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ntypes_m=5;
U_1=cell(ntypes_m,1);
U_2=cell(ntypes_m,1);
U_3=cell(ntypes_m,1);
U_4=cell(ntypes_m,1);
U_5=cell(ntypes_m,1);
for x=1:ntypes_m
    U_1{x}=[min(IdSetM{x}(:,2)); max(IdSetM{x}(:,2))];
    U_2{x}=[min(IdSetM{x}(:,3)); max(IdSetM{x}(:,3))];
    U_3{x}=[min(IdSetM{x}(:,4)); max(IdSetM{x}(:,4))];
    U_4{x}=[min(IdSetM{x}(:,5)); max(IdSetM{x}(:,5))];
    U_5{x}=[min(IdSetM{x}(:,6)); max(IdSetM{x}(:,6))];
end

save('U_intervals.mat', 'U_1', 'U_2', 'U_3', 'U_4', 'U_5')


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%% Projections in two dimensions %%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
load U_CS
for x=1:ntypes_m
    %u2x u3x
    M=unique([IdSetM{x}(:,3) IdSetM{x}(:,4)], 'rows', 'stable'); 
    figure
    scatter(M(:,1), M(:,2), 60,'k', 'filled')
    hold on
    scatter(U_CS(x,2), U_CS(x,3), 60,'r', 'filled')
    xlabel(sprintf('U_{%d2}',x),'FontSize', 25) 
    ylabel(sprintf('U_{%d3}',x),'FontSize', 25)
    xlim([-15 15])
    ylim([-15 15])
    box on
    set(gca, 'ytick',[-15 0 15],'xtick',[-15 0 15],'FontSize',20)
    saveas(gcf,sprintf('U_%d2_%d3.jpg',x,x))
    
    %u2x u4x
    M=unique([IdSetM{x}(:,3) IdSetM{x}(:,5)], 'rows', 'stable'); 
    figure
    scatter(M(:,1), M(:,2), 60,'k', 'filled')
    hold on
    scatter(U_CS(x,2), U_CS(x,4), 60,'r', 'filled')
    xlabel(sprintf('U_{%d2}',x),'FontSize', 25) 
    ylabel(sprintf('U_{%d4}',x),'FontSize', 25)
    xlim([-15 15])
    ylim([-15 15])
    box on
    set(gca, 'ytick',[-15 0 15],'xtick',[-15 0 15],'FontSize',20)
    saveas(gcf,sprintf('U_%d2_%d4.jpg',x,x))
    
    %u2x u5x
    M=unique([IdSetM{x}(:,3) IdSetM{x}(:,6)], 'rows', 'stable'); 
    figure
    scatter(M(:,1), M(:,2), 60,'k', 'filled')
    hold on
    scatter(U_CS(x,2), U_CS(x,5), 60,'r', 'filled')
    xlabel(sprintf('U_{%d2}',x),'FontSize', 25) 
    ylabel(sprintf('U_{%d5}',x),'FontSize', 25)
    xlim([-15 15])
    ylim([-15 15])
    box on
    set(gca, 'ytick',[-15 0 15],'xtick',[-15 0 15],'FontSize',20)
    saveas(gcf,sprintf('U_%d2_%d5.jpg',x,x))
    
    %u3x u4x
    M=unique([IdSetM{x}(:,4) IdSetM{x}(:,5)], 'rows', 'stable'); 
    figure
    scatter(M(:,1), M(:,2), 60,'k', 'filled')
    hold on
    scatter(U_CS(x,3), U_CS(x,4), 60,'r', 'filled')
    xlabel(sprintf('U_{%d3}',x),'FontSize', 25) 
    ylabel(sprintf('U_{%d4}',x),'FontSize', 25)
    xlim([-15 15])
    ylim([-15 15])
    box on
    set(gca, 'ytick',[-15 0 15],'xtick',[-15 0 15],'FontSize',20)
    saveas(gcf,sprintf('U_%d3_%d4.jpg',x,x))
    
    
    %u3x u5x
    M=unique([IdSetM{x}(:,4) IdSetM{x}(:,6)], 'rows', 'stable'); 
    figure
    scatter(M(:,1), M(:,2), 60,'k', 'filled')
    hold on
    scatter(U_CS(x,3), U_CS(x,5), 60,'r', 'filled')
    xlabel(sprintf('U_{%d3}',x),'FontSize', 25) 
    ylabel(sprintf('U_{%d5}',x),'FontSize', 25)
    xlim([-15 15])
    ylim([-15 15])
    box on
    set(gca, 'ytick',[-15 0 15],'xtick',[-15 0 15],'FontSize',20)
    saveas(gcf,sprintf('U_%d3_%d5.jpg',x,x))
    
    
    %u4x u5x
    M=unique([IdSetM{x}(:,5) IdSetM{x}(:,6)], 'rows', 'stable'); 
    figure
    scatter(M(:,1), M(:,2), 60,'k', 'filled')
    hold on
    scatter(U_CS(x,4), U_CS(x,5), 60,'r', 'filled')
    xlabel(sprintf('U_{%d4}',x),'FontSize', 25) 
    ylabel(sprintf('U_{%d4}',x),'FontSize', 25)
    xlim([-15 15])
    ylim([-15 15])
    box on
    set(gca, 'ytick',[-15 0 15],'xtick',[-15 0 15],'FontSize',20)
    saveas(gcf,sprintf('U_%d4_%d5.jpg',x,x))
   

end
close all





